<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <script>
        function fn(a, b) {
            if (a > b) {
                var s = a;
                a = b;
                b = s;
            }
            var sum=1;
            var res=0;
            for (; a <= b; a++) {
                sum*=a;
                res+=sum;
            }
            return res;
        }
        var a = prompt("求a~b之间的质数,请输入a","1")
        var b = prompt("求a~b之间的质数,请输入b","20")
        
        var res=fn(a, b);
        document.write("<i>"+res+"<i>");
        // document.write(a)
        // document.write(a+"这个数是质数")
    </script>
</head>

<body>

</body>

</html>